import com.aliyun.oss.OSS;
import org.junit.Test;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import top.yangbuyi.utils.OSSUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * @description: 杨不易网站:www.yangbuyi.top
 * @program: yangbuyispringcloudparent
 * @ClassName: test
 * @create: 2020-08-11 23:32
 * @author: yangbuyi
 * @since： JDK1.8
 * @test: 睡觉睡觉
 **/

public class test {

	  @Test
	  public void t() throws IOException {
			File file = new File("F:\\美女图片\\4236ea5f2195269aaba1ae6805cb1825.jpg");
			FileInputStream fileInputStream = new FileInputStream(file);
			MultipartFile mockMultipartFile = new MockMultipartFile("美女", "杨帅2.jpg", "jpg", fileInputStream);
			// 第一个是上传流  第二个是 存储目录  随便写都可以
			String yangbuyi = OSSUtils.upload(mockMultipartFile, "yangbuyi");
			System.out.println(yangbuyi);

			// 删除图片
			OSSUtils.delete("yangbuyi/6f359710f0a9fe229186bce0d23dcc9c_1597160818827.jpg");
			OSSUtils.delete("yangbuyi/我老婆_1597161069778.jpg");
	  }

}
